//package com.mida.app.knw.config;
//
//import feign.RequestInterceptor;
//import feign.RequestTemplate;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.Enumeration;
//
///**
// * dateTime：2021-06-21 15:04
// *
// * @author sheng.yu
// */
//@Configuration
//@Slf4j
//public class FeignConfiguration implements RequestInterceptor {
//    @Override
//    public void apply(RequestTemplate template) {
//        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder
//                .getRequestAttributes();
//        HttpServletRequest request = attributes.getRequest();
//        Enumeration<String> headerNames = request.getHeaderNames();
//        if (headerNames != null) {
//            while (headerNames.hasMoreElements()) {
//                String name = headerNames.nextElement();
//                if (StringUtils.equals("authorization", name.toLowerCase())) {
//                    String values = request.getHeader(name);
//                    template.header(name, values);
//                }
//            }
//            log.info("feign interceptor header:{}",template);
//        }
//
//    }
//}
